﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data;
using System.Data.SqlClient;

public partial class TheatreStaff_SpecialTickets : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        srcSpecial.SelectParameters["username"].DefaultValue = Page.User.Identity.Name;
        //srcgrdSchedule.SelectParameters["username"].DefaultValue = Page.User.Identity.Name;
        //grdSpecialTickets.Sort("MovieTitle", SortDirection.Ascending);
        string connectionString;
        connectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

        SqlConnection con = new SqlConnection(connectionString);
        SqlCommand cmd = new SqlCommand("SELECT TheatreId from TheatreStaff WHERE TheatreStaffUsername=@username", con);

        cmd.Parameters.AddWithValue("@username", Page.User.Identity.Name);

        using (con)
        {
            con.Open();
            object TheatreID = cmd.ExecuteScalar();
            if (TheatreID != null)
            {
                lblId.Text = TheatreID.ToString();
            }
        }
        SqlConnection con1 = new SqlConnection(connectionString);
        SqlCommand cmd1 = new SqlCommand("SELECT Theatrename from Theatre WHERE Theatreid=@theatreid", con1);

        cmd1.Parameters.AddWithValue("@theatreid", lblId.Text);


        using (con1)
        {
            con1.Open();
            object Theatrename = cmd1.ExecuteScalar();

            if (Theatrename != null)
            {
                Label4.Text = Theatrename.ToString();

            }
        }

    }
}
